<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<title>S-Pet Index Page(v0.3)</title>
<link rel="stylesheet" type="text/css" href="css/1128.css">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0-rc.1/jquery.mobile.structure-1.4.0-rc.1.min.css" /> 
<!--<link href="lib/jquery.mobile-1.3.2.css" type="text/css" rel="stylesheet">-->
    <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="lib/jquery.mobile-1.3.2.js"></script>
	<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
	<script type="text/javascript" charset="utf-8" src="js/phonegap-nfc.js"></script>
	<script type="text/javascript" charset="utf-8" src="phonegap-toast.js"></script>
    <script type="text/javascript">
     $(function(){
    	 onDeviceReady();
//    	app.initialize();
    });
    
 	function handleOpenURL(url) {
	    alert("앱화면 : 찾아주셔서 감사합니다.\n(전단 페이지로 이동합니다)\n received url: " + url);
		if(url == 'spet://write'){
			window.location.replace('write.html');
		}else if(url != ''){
//			window.location.replace("http://70.12.110.62:8888/view.html?i=1385347318500");
			window.location.replace(url);
		}
	}
</script>

</head>
<body>
	<div data-role="page" id="main">
		<img alt="Logo" src="img/logo.png">
		
		<div data-role="header" data-theme="a">
			<h1>S-Pet Test v0.33.2</h1>
		</div>
		
		<!-- 메인화면 content 메뉴 -->
		<div data-role="content" data-theme="a">
			<ul data-role="listview">
				<li><a href="#read" data-transition="flow">Read TAG</a></li>
				<li><a href="spet://write">Write TAG</a></li>			
				<li><a href="read.html" data-transition="flow">Read.html</a></li>
				<li><a href="spetw://">Write.html</a></li>
				<li><a href="log.html" data-transition="slide">Log View(기록 정보)</a></li>			
				<li><a href="http://70.12.110.62:8888/sosList" data-transition="slide">SOS List(실종동물)</a></li>
				<li><a href="abc.html" rel="external">PG API</a></li>			
				<li><a href="map.html" rel="external">Map Test</a></li>			
			</ul>
		</div>
		
		<div data-role="footer" data-theme="a" style="text-align : center;">
			<a href="http://70.12.110.62:8888/log" data-icon="alert">Admin</a>
		</div>		
	</div>

	<!-- 메인read 페이지 -->
	<div data-role="page" id="read">
    <script id="non-ndef-template" type="text/x-handlebars-template">
        <p>Scanned a non-NDEF NFC tag</p>
        <p>
            Tag Id: <strong>{{ bytesToHexString id }}</strong>
        </p>
    </script>

    <script id="tag-template" type="text/x-handlebars-template">
        <p>Scanned an NDEF tag with {{ ndefMessage.length }} {{ pluralize ndefMessage.length 'record' 'records' }}</p>

        {{!
            BB10 and WP8 will not have any meta info
            Android P2P will not have id, but will have type
        }}
        <dl>
            {{#if id}}
            <dt>Tag Id</dt>             <dd>{{ bytesToHexString id }}</dd>
            {{/if}}
            
            {{#if type}}
            <dt>Tag Type</dt>           <dd>{{ type }}</dd>
            {{/if}}

            {{#if maxSize }}
            <dt>Max Size</dt>           <dd>{{ maxSize }} bytes</dd>
            {{/if}}            

            {{#if freeSpaceSize }}
            <dt>Free Space</dt>         <dd>{{ freeSpaceSize }} bytes</dd>
            {{/if}}

            {{#if id}}
            <dt>Is Writable</dt>        <dd>{{ toString isWritable }}</dd>
            <dt>Can Make Read Only</dt> <dd>{{ toString canMakeReadOnly }}</dd>
            {{/if}}            
        </dl>

        {{#each ndefMessage}}  {{! does not read well, iterating on records non messages}}
        <div class='record'>
            Record {{ @index }}:<br/>
            TNF: <b>{{ tnfToString tnf }}</b><br/>        
            {{#if tnf}}
                Record Type: <b>{{ bytesToString type }}</b><br/>
                Payload: <b>{{ decodePayload this }}</b><br/>
                {{#if id}}
                    Record Id: <b>{{ bytesToString id }}</b><br/>            
                {{/if}}
            {{/if}}
        </div>
        {{/each}}
    </script>
        <script type="text/javascript" charset="utf-8" src="js/read.js"></script>
    
        <div data-role="header" data-theme="a" data-add-back-btn="true">
			<a href="#main" data-icon="home" class="ui=btn-left">Main</a>
            <h1>Read Page</h1>
        </div>
    <h1>S-Pet NFC Reader</h1>
    <div id="tagContents">
        <div class="hidden">
            Scan a tag to being.

	       	<img src="img/nfc_logo.png">
            <h1>"휴대폰 뒷면에 S-Pet 태그를 탭해주십시오."</h1>
        </div>
    </div>
</div>

</body>
</html>